<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
</head>
<body>
<div id="app">
    <h3>已经出库的商品</h3>
    <ul>
        <li v-for="goods in outGoodss">
            {{goods.name}}
        </li>
    </ul>
    <h3>没有出库的商品</h3>
    <ul>
        <li v-for="goods in inGoodss">
        {{goods.name}}
        </li>
    </ul>
</div>
<!--引入vue文件-->
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
    //创建一个应用程序实例
    const vm= Vue.createApp({
        //该函数返回数据对象
        data(){
          return{
            goodss: [
              {name: '洗衣机', isOut: false},
              {name: '冰箱', isOut: true},
              {name: '空调', isOut: false},
              {name: '电视机', isOut: true},
              {name: '电脑', isOut: false}
            ]
           }
        },
        computed:{
            outGoodss(){
                return this.goodss.filter(goods=>goods.isOut);
             },
            inGoodss(){
                return this.goodss.filter(goods=>!goods.isOut);
             }
        }
    //在指定的DOM元素上装载应用程序实例的根组件
    }).mount('#app');
</script>

</body>
</html>
